<template>
  <div class="todo-footer">
    <label>
      <!--<input type="checkbox" v-model="isAllCheck" @click="handleSelectAll"/>-->
      <slot name="checkAll"></slot>

    </label>
    <span>
         <!-- <span>已完成{{completeSize}}/ 全部{{this.todos.length}}</span>-->
      <slot name="count"></slot>
    </span>
    <!--<button class="btn btn-danger" @click="this.deleteCompleteTodos" v-show="completeSize>0">清除已完成任务</button>-->
    <slot name="delete"></slot>
  </div>
</template>

<script>
  export default {
    name: "TodoFoot",
    /*props: {
      todos: Array,
      deleteCompleteTodos: Function,
      selectAllTodos: Function
    },*/
    /*computed: {
      // 完成数量
      completeSize() {
        // return this.todos.filter(todo => todo.complete).length
        return this.todos.reduce((preTotal, todo) => preTotal + (todo.complete ? 1 : 0), 0);
      },
      // 读取他的值，还得监视他的变化
      isAllCheck: {
        // 读取值
        get() {
          const {completeSize, todos} = this;
          return completeSize > 0 && completeSize === todos.length
        },
        // 监视变化
        set(value) { // 最新的状态属性值
          this.selectAllTodos(value);
        }
      }
    },*/
    /*methods: {
      handleSelectAll() {
        this.selectAllTodos(!this.isCompleteAll);
      }
    }*/
  }
</script>

<style scoped>
  /*footer*/
  .todo-footer {
    height: 40px;
    line-height: 40px;
    padding-left: 6px;
    margin-top: 5px;
  }

  .todo-footer label {
    display: inline-block;
    margin-right: 20px;
    cursor: pointer;
  }

  .todo-footer label input {
    position: relative;
    top: -1px;
    vertical-align: middle;
    margin-right: 5px;
  }

  .todo-footer button {
    float: right;
    margin-top: 5px;
  }

</style>
